home *** CD-ROM | disk | FTP | other *** search
- PROGRAM DIR;
- {
- JUNE 28, 1984
-
- Author: Todd Little
- 1318 Bullock
- Houston, TX 77055
- 713-984-2055 h
- 578-3210 w
-
- }
-
- VAR
- es,bx :INTEGER;
- al :BYTE;
- file_search : STRING[20];
-
- PROCEDURE getdta;
-
- {
- Get the current DTA (data transfer address)
- Use the DOS call 2f to put the DTA into ES:BX
- Then put these into the variables of the same name
-
- }
- BEGIN
- INLINE
- ( $b4/$2f/ {mov ah,2f}
- $cd/$21/ {int,21}
- $89/$1e/bx/ {mov (bx),bx }
- $8c/$c3/ {mov bx,es }
- $89/$1e/es {mov (es),bx }
- )
- END;
-
-
-
- PROCEDURE getdir(VAR file_search);
-
- {
- Get the directory by using the find first operation, dos call 4e
- get subsequent entries using dos call 4f
-
- file_search should contain the matching parameters, i.e. *.*
- }
- VAR
- i,j : INTEGER;
- file_name : STRING[20];
-
-
- BEGIN
-
-
- BEGIN;
- INLINE (
- $8b/$56/$04/ {mov dx,[bp+04] point to file_search}
- $81/$c2/$01/$00/{add dx,0001 move past the string length}
- $b9/$00/$00/ {mov cx,0010 search for files (inc dir)}
- $b4/$4e/ {mov ah,4e dos call 4e}
- $cd/$21/ {int 21h }
- $a2/al {mov (al),al save the error code}
- )
- END;
-
- j := 0;
- WRITELN;
-
- WHILE (al <> 02) AND (al <> 18) DO
- BEGIN
-
- IF j MOD 5 = 0 THEN
- WRITELN;
-
- i := 30;
- file_name := '';
-
- WHILE MEM[es:bx+i] <> 0 DO
- BEGIN
- file_name := CONCAT(file_name,CHR(MEM[es:bx+i]) );
- i := i +1;
- END;
-
- WRITE(file_name:15);
- j := j +1;
-
- BEGIN
- INLINE (
- $b4/$4f/ {mov ah,4f find next}
- $cd/$21/ {int 21h with dos call 4f}
- $a2/al {mov (al),al save return code}
- )
- END;
-
- END;
-
- END;
-
- BEGIN
-
- getdta;
- file_search := CONCAT( '*.*',CHR(0) );
- getdir(file_search);
- END.